import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

export default new Router({
	scrollBehavior(to, from, savePosition) { // 在点击浏览器的“前进/后退”，或者切换导航的时候触发。
		if (savePosition) {
			let t = 260;
			if (window.innerWidth > 768) {
				t = 400;
			}
			return {
				x: 0,
				y: t
			};
		} else {
			return {
				x: 0,
				y: 0
			}
		}
	},
	routes: [{
			path: '/',
			component: resolve => require(['../pages/Home.vue'], resolve),
			meta: {
				auth: true
			},
			name: 'Home'
		}, //首页
		{
			path: '/Home',
			component: resolve => require(['../pages/Home.vue'], resolve),
			meta: {
				auth: true
			},
			name: 'Home'
		}, //首页
		{
			path: '/Share',
			component: resolve => require(['../pages/Share.vue'], resolve),
			meta: {
				auth: true
			},
			name: 'Share'
		}, //分类
		{
			path: '/DetailArticle',
			component: resolve => require(['../pages/DetailArticle.vue'], resolve),
			meta: {
				auth: true
			},
			name: 'DetailArticle'
		}, //文章详情
		{
			path:'/Message',
			component:resolve => require(['../pages/Message.vue'],resolve),
			meta:{
				auth:true
			},
		},//留言
		{
			path: '/Photo',
			component: resolve => require(['../pages/photo.vue'], resolve),
			meta: {
				auth: true
			},
			name: 'Photo'
		}, //相册
		{
			path: '/FriendsLink',
			component: resolve => require(['../pages/FriendsLink.vue'], resolve),
			meta: {
				auth: true
			},
			name: 'FriendsLink'
		}, //友链
		{
			path: '/Login',
			component: resolve => require(['../pages/Login.vue'], resolve),
			meta: {
				auth: false
			},
			name: 'Login'
		}, //注册登录

		{
			path:'/demo',
			component:resolve => require(['../pages/demo.vue'],resolve),
			meta:{
				auth:true
			},
			name:'demo'
		},
		{
			path:'/music',
			component:resolve =>require(['../pages/music.vue'],resolve),
			meta:{
				auth:true
			},
			name:'music'
		}
		,
		{
			path:'/record',
			component:resolve =>require(['../pages/Record.vue'],resolve),
			meta:{
				auth:true
			},
			name:'Record'
		}
		,
		{
			path: '/UserInfo',
			component: resolve => require(['../pages/UserInfo.vue'], resolve),
			meta: {
				auth: true
			},
			name: 'UserInfo'
		},] //用户个人中心`]
		
})
